3.4.5 \(\int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx\) [305]

3.4.5.1 Optimal result
3.4.5.2 Mathematica [B] (verified)
3.4.5.3 Rubi [A] (verified)
3.4.5.4 Maple [A] (verified)
3.4.5.5 Fricas [A] (verification not implemented)
3.4.5.6 Sympy [F]
3.4.5.7 Maxima [A] (verification not implemented)
3.4.5.8 Giac [B] (verification not implemented)
3.4.5.9 Mupad [B] (verification not implemented)

3.4.5.1 Optimal result

Integrand size = 29, antiderivative size = 195 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=a^3 (4 A b+a B) x+\frac {b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {a A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b \left (6 a^3 A-12 a A b^2-17 a^2 b B-2 b^3 B\right ) \tan (c+d x)}{3 d}-\frac {b^2 \left (6 a^2 A-3 A b^2-8 a b B\right ) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 a A-b B) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d} \]

output
a^3*(4*A*b+B*a)*x+1/2*b*(12*A*a^2*b+A*b^3+8*B*a^3+4*B*a*b^2)*arctanh(sin(d 
*x+c))/d+a*A*(a+b*sec(d*x+c))^3*sin(d*x+c)/d-1/3*b*(6*A*a^3-12*A*a*b^2-17* 
B*a^2*b-2*B*b^3)*tan(d*x+c)/d-1/6*b^2*(6*A*a^2-3*A*b^2-8*B*a*b)*sec(d*x+c) 
*tan(d*x+c)/d-1/3*b*(3*A*a-B*b)*(a+b*sec(d*x+c))^2*tan(d*x+c)/d
 
3.4.5.2 Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(469\) vs. \(2(195)=390\).

Time = 8.14 (sec) , antiderivative size = 469, normalized size of antiderivative = 2.41 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {\cos ^5(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \left (12 a^3 (4 A b+a B) (c+d x)-6 b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+6 b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^3 (3 A b+(12 a+b) B)}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {2 b^4 B \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}+\frac {8 b^2 \left (6 a A b+9 a^2 B+b^2 B\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}+\frac {2 b^4 B \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}-\frac {b^3 (3 A b+(12 a+b) B)}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {8 b^2 \left (6 a A b+9 a^2 B+b^2 B\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}+12 a^4 A \sin (c+d x)\right )}{12 d (b+a \cos (c+d x))^4 (B+A \cos (c+d x))} \]

input
Integrate[Cos[c + d*x]*(a + b*Sec[c + d*x])^4*(A + B*Sec[c + d*x]),x]
 
output
(Cos[c + d*x]^5*(a + b*Sec[c + d*x])^4*(A + B*Sec[c + d*x])*(12*a^3*(4*A*b 
 + a*B)*(c + d*x) - 6*b*(12*a^2*A*b + A*b^3 + 8*a^3*B + 4*a*b^2*B)*Log[Cos 
[(c + d*x)/2] - Sin[(c + d*x)/2]] + 6*b*(12*a^2*A*b + A*b^3 + 8*a^3*B + 4* 
a*b^2*B)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] + (b^3*(3*A*b + (12*a + 
b)*B))/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])^2 + (2*b^4*B*Sin[(c + d*x)/2] 
)/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])^3 + (8*b^2*(6*a*A*b + 9*a^2*B + b^ 
2*B)*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2]) + (2*b^4*B*Si 
n[(c + d*x)/2])/(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])^3 - (b^3*(3*A*b + (1 
2*a + b)*B))/(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])^2 + (8*b^2*(6*a*A*b + 9 
*a^2*B + b^2*B)*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] + Sin[(c + d*x)/2]) + 
12*a^4*A*Sin[c + d*x]))/(12*d*(b + a*Cos[c + d*x])^4*(B + A*Cos[c + d*x]))
 
3.4.5.3 Rubi [A] (verified)

Time = 0.81 (sec) , antiderivative size = 202, normalized size of antiderivative = 1.04, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.276, Rules used = {3042, 4513, 25, 3042, 4544, 3042, 4536, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right )^4 \left (A+B \csc \left (c+d x+\frac {\pi }{2}\right )\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 4513

\(\displaystyle \frac {a A \sin (c+d x) (a+b \sec (c+d x))^3}{d}-\int -(a+b \sec (c+d x))^2 \left (-b (3 a A-b B) \sec ^2(c+d x)+b (A b+2 a B) \sec (c+d x)+a (4 A b+a B)\right )dx\)

\(\Big \downarrow \) 25

\(\displaystyle \int (a+b \sec (c+d x))^2 \left (-b (3 a A-b B) \sec ^2(c+d x)+b (A b+2 a B) \sec (c+d x)+a (4 A b+a B)\right )dx+\frac {a A \sin (c+d x) (a+b \sec (c+d x))^3}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (-b (3 a A-b B) \csc \left (c+d x+\frac {\pi }{2}\right )^2+b (A b+2 a B) \csc \left (c+d x+\frac {\pi }{2}\right )+a (4 A b+a B)\right )dx+\frac {a A \sin (c+d x) (a+b \sec (c+d x))^3}{d}\)

\(\Big \downarrow \) 4544

\(\displaystyle \frac {1}{3} \int (a+b \sec (c+d x)) \left (3 (4 A b+a B) a^2-b \left (6 A a^2-8 b B a-3 A b^2\right ) \sec ^2(c+d x)+b \left (9 B a^2+9 A b a+2 b^2 B\right ) \sec (c+d x)\right )dx-\frac {b (3 a A-b B) \tan (c+d x) (a+b \sec (c+d x))^2}{3 d}+\frac {a A \sin (c+d x) (a+b \sec (c+d x))^3}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{3} \int \left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right ) \left (3 (4 A b+a B) a^2-b \left (6 A a^2-8 b B a-3 A b^2\right ) \csc \left (c+d x+\frac {\pi }{2}\right )^2+b \left (9 B a^2+9 A b a+2 b^2 B\right ) \csc \left (c+d x+\frac {\pi }{2}\right )\right )dx-\frac {b (3 a A-b B) \tan (c+d x) (a+b \sec (c+d x))^2}{3 d}+\frac {a A \sin (c+d x) (a+b \sec (c+d x))^3}{d}\)

\(\Big \downarrow \) 4536

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \int \left (6 (4 A b+a B) a^3-2 b \left (6 A a^3-17 b B a^2-12 A b^2 a-2 b^3 B\right ) \sec ^2(c+d x)+3 b \left (8 B a^3+12 A b a^2+4 b^2 B a+A b^3\right ) \sec (c+d x)\right )dx-\frac {b^2 \left (6 a^2 A-8 a b B-3 A b^2\right ) \tan (c+d x) \sec (c+d x)}{2 d}\right )-\frac {b (3 a A-b B) \tan (c+d x) (a+b \sec (c+d x))^2}{3 d}+\frac {a A \sin (c+d x) (a+b \sec (c+d x))^3}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \left (6 a^3 x (a B+4 A b)+\frac {3 b \left (8 a^3 B+12 a^2 A b+4 a b^2 B+A b^3\right ) \text {arctanh}(\sin (c+d x))}{d}-\frac {2 b \left (6 a^3 A-17 a^2 b B-12 a A b^2-2 b^3 B\right ) \tan (c+d x)}{d}\right )-\frac {b^2 \left (6 a^2 A-8 a b B-3 A b^2\right ) \tan (c+d x) \sec (c+d x)}{2 d}\right )-\frac {b (3 a A-b B) \tan (c+d x) (a+b \sec (c+d x))^2}{3 d}+\frac {a A \sin (c+d x) (a+b \sec (c+d x))^3}{d}\)

input
Int[Cos[c + d*x]*(a + b*Sec[c + d*x])^4*(A + B*Sec[c + d*x]),x]
 
output
(a*A*(a + b*Sec[c + d*x])^3*Sin[c + d*x])/d - (b*(3*a*A - b*B)*(a + b*Sec[ 
c + d*x])^2*Tan[c + d*x])/(3*d) + (-1/2*(b^2*(6*a^2*A - 3*A*b^2 - 8*a*b*B) 
*Sec[c + d*x]*Tan[c + d*x])/d + (6*a^3*(4*A*b + a*B)*x + (3*b*(12*a^2*A*b 
+ A*b^3 + 8*a^3*B + 4*a*b^2*B)*ArcTanh[Sin[c + d*x]])/d - (2*b*(6*a^3*A - 
12*a*A*b^2 - 17*a^2*b*B - 2*b^3*B)*Tan[c + d*x])/d)/2)/3
 

3.4.5.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4513
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[a*A*Cot 
[e + f*x]*(a + b*Csc[e + f*x])^(m - 1)*((d*Csc[e + f*x])^n/(f*n)), x] + Sim 
p[1/(d*n)   Int[(a + b*Csc[e + f*x])^(m - 2)*(d*Csc[e + f*x])^(n + 1)*Simp[ 
a*(a*B*n - A*b*(m - n - 1)) + (2*a*b*B*n + A*(b^2*n + a^2*(1 + n)))*Csc[e + 
 f*x] + b*(b*B*n + a*A*(m + n))*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, 
d, e, f, A, B}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] & 
& LeQ[n, -1]
 

rule 4536
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_. 
))*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(-b)*C*Csc[e + 
 f*x]*(Cot[e + f*x]/(2*f)), x] + Simp[1/2   Int[Simp[2*A*a + (2*B*a + b*(2* 
A + C))*Csc[e + f*x] + 2*(a*C + B*b)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a 
, b, e, f, A, B, C}, x]
 

rule 4544
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_. 
))*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Simp[(-C)*Cot 
[e + f*x]*((a + b*Csc[e + f*x])^m/(f*(m + 1))), x] + Simp[1/(m + 1)   Int[( 
a + b*Csc[e + f*x])^(m - 1)*Simp[a*A*(m + 1) + ((A*b + a*B)*(m + 1) + b*C*m 
)*Csc[e + f*x] + (b*B*(m + 1) + a*C*m)*Csc[e + f*x]^2, x], x], x] /; FreeQ[ 
{a, b, e, f, A, B, C}, x] && NeQ[a^2 - b^2, 0] && IGtQ[2*m, 0]
 
3.4.5.4 Maple [A] (verified)

Time = 3.90 (sec) , antiderivative size = 209, normalized size of antiderivative = 1.07

method result size
derivativedivides \(\frac {a^{4} A \sin \left (d x +c \right )+B \,a^{4} \left (d x +c \right )+4 A \,a^{3} b \left (d x +c \right )+4 B \,a^{3} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 A \,a^{2} b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 B \tan \left (d x +c \right ) a^{2} b^{2}+4 A \tan \left (d x +c \right ) a \,b^{3}+4 B a \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,b^{4} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-B \,b^{4} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )}{d}\) \(209\)
default \(\frac {a^{4} A \sin \left (d x +c \right )+B \,a^{4} \left (d x +c \right )+4 A \,a^{3} b \left (d x +c \right )+4 B \,a^{3} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 A \,a^{2} b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 B \tan \left (d x +c \right ) a^{2} b^{2}+4 A \tan \left (d x +c \right ) a \,b^{3}+4 B a \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,b^{4} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-B \,b^{4} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )}{d}\) \(209\)
parallelrisch \(\frac {-108 b \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) \left (A \,a^{2} b +\frac {1}{12} A \,b^{3}+\frac {2}{3} B \,a^{3}+\frac {1}{3} B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+108 b \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) \left (A \,a^{2} b +\frac {1}{12} A \,b^{3}+\frac {2}{3} B \,a^{3}+\frac {1}{3} B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+24 \left (A b +\frac {B a}{4}\right ) d x \,a^{3} \cos \left (3 d x +3 c \right )+6 \left (a^{4} A +A \,b^{4}+4 B a \,b^{3}\right ) \sin \left (2 d x +2 c \right )+4 \left (6 A a \,b^{3}+9 B \,a^{2} b^{2}+B \,b^{4}\right ) \sin \left (3 d x +3 c \right )+3 a^{4} A \sin \left (4 d x +4 c \right )+72 \left (A b +\frac {B a}{4}\right ) d x \,a^{3} \cos \left (d x +c \right )+24 \sin \left (d x +c \right ) b^{2} \left (A a b +\frac {3}{2} B \,a^{2}+\frac {1}{2} b^{2} B \right )}{6 d \left (\cos \left (3 d x +3 c \right )+3 \cos \left (d x +c \right )\right )}\) \(295\)
risch \(4 A \,a^{3} b x +a^{4} x B -\frac {i a^{4} A \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i a^{4} A \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}-\frac {i b^{2} \left (3 A \,b^{2} {\mathrm e}^{5 i \left (d x +c \right )}+12 B a b \,{\mathrm e}^{5 i \left (d x +c \right )}-24 A a b \,{\mathrm e}^{4 i \left (d x +c \right )}-36 B \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-48 A a b \,{\mathrm e}^{2 i \left (d x +c \right )}-72 B \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-12 B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 A \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-12 B a b \,{\mathrm e}^{i \left (d x +c \right )}-24 A a b -36 B \,a^{2}-4 b^{2} B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {6 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,a^{2} b^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,b^{4}}{2 d}-\frac {4 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,a^{3} b}{d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B a \,b^{3}}{d}+\frac {6 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,a^{2} b^{2}}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,b^{4}}{2 d}+\frac {4 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,a^{3} b}{d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B a \,b^{3}}{d}\) \(411\)
norman \(\frac {\left (4 A \,a^{3} b +B \,a^{4}\right ) x +\left (-12 A \,a^{3} b -3 B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (-12 A \,a^{3} b -3 B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (4 A \,a^{3} b +B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}+\left (8 A \,a^{3} b +2 B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\left (8 A \,a^{3} b +2 B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\frac {\left (2 a^{4} A -8 A a \,b^{3}+A \,b^{4}-12 B \,a^{2} b^{2}+4 B a \,b^{3}-2 B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}+\frac {\left (2 a^{4} A +8 A a \,b^{3}+A \,b^{4}+12 B \,a^{2} b^{2}+4 B a \,b^{3}+2 B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {2 \left (6 a^{4} A -A \,b^{4}-4 B a \,b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {4 \left (6 a^{4} A -12 A a \,b^{3}-18 B \,a^{2} b^{2}-B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{3 d}-\frac {4 \left (6 a^{4} A +12 A a \,b^{3}+18 B \,a^{2} b^{2}+B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right ) \left (-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{4}}-\frac {b \left (12 A \,a^{2} b +A \,b^{3}+8 B \,a^{3}+4 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {b \left (12 A \,a^{2} b +A \,b^{3}+8 B \,a^{3}+4 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) \(506\)

input
int(cos(d*x+c)*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x,method=_RETURNVERBOSE 
)
 
output
1/d*(a^4*A*sin(d*x+c)+B*a^4*(d*x+c)+4*A*a^3*b*(d*x+c)+4*B*a^3*b*ln(sec(d*x 
+c)+tan(d*x+c))+6*A*a^2*b^2*ln(sec(d*x+c)+tan(d*x+c))+6*B*tan(d*x+c)*a^2*b 
^2+4*A*tan(d*x+c)*a*b^3+4*B*a*b^3*(1/2*sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(d* 
x+c)+tan(d*x+c)))+A*b^4*(1/2*sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(d*x+c)+tan(d 
*x+c)))-B*b^4*(-2/3-1/3*sec(d*x+c)^2)*tan(d*x+c))
 
3.4.5.5 Fricas [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 219, normalized size of antiderivative = 1.12 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {12 \, {\left (B a^{4} + 4 \, A a^{3} b\right )} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (6 \, A a^{4} \cos \left (d x + c\right )^{3} + 2 \, B b^{4} + 4 \, {\left (9 \, B a^{2} b^{2} + 6 \, A a b^{3} + B b^{4}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \]

input
integrate(cos(d*x+c)*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="fri 
cas")
 
output
1/12*(12*(B*a^4 + 4*A*a^3*b)*d*x*cos(d*x + c)^3 + 3*(8*B*a^3*b + 12*A*a^2* 
b^2 + 4*B*a*b^3 + A*b^4)*cos(d*x + c)^3*log(sin(d*x + c) + 1) - 3*(8*B*a^3 
*b + 12*A*a^2*b^2 + 4*B*a*b^3 + A*b^4)*cos(d*x + c)^3*log(-sin(d*x + c) + 
1) + 2*(6*A*a^4*cos(d*x + c)^3 + 2*B*b^4 + 4*(9*B*a^2*b^2 + 6*A*a*b^3 + B* 
b^4)*cos(d*x + c)^2 + 3*(4*B*a*b^3 + A*b^4)*cos(d*x + c))*sin(d*x + c))/(d 
*cos(d*x + c)^3)
 
3.4.5.6 Sympy [F]

\[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{4} \cos {\left (c + d x \right )}\, dx \]

input
integrate(cos(d*x+c)*(a+b*sec(d*x+c))**4*(A+B*sec(d*x+c)),x)
 
output
Integral((A + B*sec(c + d*x))*(a + b*sec(c + d*x))**4*cos(c + d*x), x)
 
3.4.5.7 Maxima [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.26 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {12 \, {\left (d x + c\right )} B a^{4} + 48 \, {\left (d x + c\right )} A a^{3} b + 4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} B b^{4} - 12 \, B a b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 3 \, A b^{4} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 24 \, B a^{3} b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 36 \, A a^{2} b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, A a^{4} \sin \left (d x + c\right ) + 72 \, B a^{2} b^{2} \tan \left (d x + c\right ) + 48 \, A a b^{3} \tan \left (d x + c\right )}{12 \, d} \]

input
integrate(cos(d*x+c)*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="max 
ima")
 
output
1/12*(12*(d*x + c)*B*a^4 + 48*(d*x + c)*A*a^3*b + 4*(tan(d*x + c)^3 + 3*ta 
n(d*x + c))*B*b^4 - 12*B*a*b^3*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log( 
sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) - 3*A*b^4*(2*sin(d*x + c)/(sin( 
d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) + 24*B*a^ 
3*b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 36*A*a^2*b^2*(log(si 
n(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 12*A*a^4*sin(d*x + c) + 72*B*a^ 
2*b^2*tan(d*x + c) + 48*A*a*b^3*tan(d*x + c))/d
 
3.4.5.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 387 vs. \(2 (187) = 374\).

Time = 0.37 (sec) , antiderivative size = 387, normalized size of antiderivative = 1.98 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {\frac {12 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1} + 6 \, {\left (B a^{4} + 4 \, A a^{3} b\right )} {\left (d x + c\right )} + 3 \, {\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (36 \, B a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 24 \, A a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 12 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 72 \, B a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 48 \, A a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 36 \, B a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 24 \, A a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 12 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \]

input
integrate(cos(d*x+c)*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="gia 
c")
 
output
1/6*(12*A*a^4*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 + 1) + 6*(B*a^4 
 + 4*A*a^3*b)*(d*x + c) + 3*(8*B*a^3*b + 12*A*a^2*b^2 + 4*B*a*b^3 + A*b^4) 
*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 3*(8*B*a^3*b + 12*A*a^2*b^2 + 4*B*a* 
b^3 + A*b^4)*log(abs(tan(1/2*d*x + 1/2*c) - 1)) - 2*(36*B*a^2*b^2*tan(1/2* 
d*x + 1/2*c)^5 + 24*A*a*b^3*tan(1/2*d*x + 1/2*c)^5 - 12*B*a*b^3*tan(1/2*d* 
x + 1/2*c)^5 - 3*A*b^4*tan(1/2*d*x + 1/2*c)^5 + 6*B*b^4*tan(1/2*d*x + 1/2* 
c)^5 - 72*B*a^2*b^2*tan(1/2*d*x + 1/2*c)^3 - 48*A*a*b^3*tan(1/2*d*x + 1/2* 
c)^3 - 4*B*b^4*tan(1/2*d*x + 1/2*c)^3 + 36*B*a^2*b^2*tan(1/2*d*x + 1/2*c) 
+ 24*A*a*b^3*tan(1/2*d*x + 1/2*c) + 12*B*a*b^3*tan(1/2*d*x + 1/2*c) + 3*A* 
b^4*tan(1/2*d*x + 1/2*c) + 6*B*b^4*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/ 
2*c)^2 - 1)^3)/d
 
3.4.5.9 Mupad [B] (verification not implemented)

Time = 16.74 (sec) , antiderivative size = 636, normalized size of antiderivative = 3.26 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {\frac {A\,a^4\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {A\,a^4\,\sin \left (4\,c+4\,d\,x\right )}{8}+\frac {A\,b^4\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {B\,b^4\,\sin \left (3\,c+3\,d\,x\right )}{6}+\frac {B\,b^4\,\sin \left (c+d\,x\right )}{2}+A\,a\,b^3\,\sin \left (c+d\,x\right )+\frac {3\,B\,a^4\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}-\frac {A\,b^4\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{4}+A\,a\,b^3\,\sin \left (3\,c+3\,d\,x\right )+B\,a\,b^3\,\sin \left (2\,c+2\,d\,x\right )+\frac {3\,B\,a^2\,b^2\,\sin \left (c+d\,x\right )}{2}+\frac {B\,a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {A\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{4}+\frac {3\,B\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{2}+2\,A\,a^3\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )-A\,a^2\,b^2\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}-B\,a\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}-B\,a^3\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,2{}\mathrm {i}-A\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}+6\,A\,a^3\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-B\,a\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}-B\,a^3\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,6{}\mathrm {i}}{d\,\left (\frac {3\,\cos \left (c+d\,x\right )}{4}+\frac {\cos \left (3\,c+3\,d\,x\right )}{4}\right )} \]

input
int(cos(c + d*x)*(A + B/cos(c + d*x))*(a + b/cos(c + d*x))^4,x)
 
output
((A*a^4*sin(2*c + 2*d*x))/4 + (A*a^4*sin(4*c + 4*d*x))/8 + (A*b^4*sin(2*c 
+ 2*d*x))/4 + (B*b^4*sin(3*c + 3*d*x))/6 + (B*b^4*sin(c + d*x))/2 + A*a*b^ 
3*sin(c + d*x) + (3*B*a^4*cos(c + d*x)*atan(sin(c/2 + (d*x)/2)/cos(c/2 + ( 
d*x)/2)))/2 - (A*b^4*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + ( 
d*x)/2))*3i)/4 + A*a*b^3*sin(3*c + 3*d*x) + B*a*b^3*sin(2*c + 2*d*x) + (3* 
B*a^2*b^2*sin(c + d*x))/2 + (B*a^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x) 
/2))*cos(3*c + 3*d*x))/2 - (A*b^4*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + ( 
d*x)/2))*cos(3*c + 3*d*x)*1i)/4 + (3*B*a^2*b^2*sin(3*c + 3*d*x))/2 + 2*A*a 
^3*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x) - A*a^2* 
b^2*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*9i - B*a 
*b^3*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x)*1i 
- B*a^3*b*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x 
)*2i - A*a^2*b^2*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c 
+ 3*d*x)*3i + 6*A*a^3*b*cos(c + d*x)*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d* 
x)/2)) - B*a*b^3*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x) 
/2))*3i - B*a^3*b*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x 
)/2))*6i)/(d*((3*cos(c + d*x))/4 + cos(3*c + 3*d*x)/4))